package com.yc.cloud.portal.controller;

import com.yc.cloud.basic.api.ResponseResult;
import com.yc.cloud.portal.service.AvatarsWakeupService;
import com.yc.cloud.portal.vo.AvatarsWakeupVo;
import com.yc.cloud.security.utils.MemberUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.val;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 数字人唤醒词
 *
 * @author Yancy
 * @date 2024-04-11
 */
@RestController
@RequestMapping("/avatars/wakeup")
@Api(value = "数字人唤醒词", tags = "数字人唤醒词接口")
public class AvatarsWakeupController {

    @Resource
    private AvatarsWakeupService avatarsWakeupService;


//    @GetMapping
//    @ApiOperation(value = "数字人唤醒词列表", notes = "支持分页查询,字段模糊匹配,排序等")
//    public ResponseResult<CommonPage<AvatarsWakeup>> list(BaseQueryParam param) {
//        val result = avatarsWakeupService.list(param);
//        return ResponseResult.success(CommonPage.restPage(result));
//    }


    @GetMapping("info")
    @ApiOperation(value = "获取数字人唤醒词", notes = "根据当前账号所属企业查询")
    public ResponseResult<AvatarsWakeupVo> info() {
        val result = avatarsWakeupService.getByCompanyId(MemberUtils.getCurrentCompanyId());
        return ResponseResult.success(avatarsWakeupService.convertVo(result));
    }


//    @PostMapping
//    @ApiOperation(value = "添加数字人唤醒词", notes = "添加")
//    public ResponseResult<AvatarsWakeup> create(@Validated @RequestBody AvatarsWakeup param) {
//        val result = avatarsWakeupService.create(param);
//        return result != null ? ResponseResult.success(result) : ResponseResult.failed();
//    }
//
//
//    @ApiOperation(value = "删除数字人唤醒词", notes = "通过ID删除")
//    @DeleteMapping(value = "{id}")
//    public ResponseResult<Boolean> delete(@PathVariable @ApiParam(value = "ID", required = true) Long id) {
//        val result = avatarsWakeupService.delete(id);
//        return result ? ResponseResult.success(true) : ResponseResult.failed();
//    }
//
//
//    @ApiOperation(value = "修改数字人唤醒词", notes = "通过ID修改")
//    @PutMapping(value = "{id}")
//    public ResponseResult<AvatarsWakeup> update(@PathVariable @ApiParam(value = "ID", required = true) Long id, @Validated @RequestBody AvatarsWakeup param) {
//        val result = avatarsWakeupService.update(id, param);
//        return result != null ? ResponseResult.success(result) : ResponseResult.failed();
//    }
}
